<script setup lang="ts">
import {ref} from 'vue';
const username= ref("");

// 宏defineModel返回的是一个 ref
const passwd = defineModel();
// const childString: string = defineModel();   // 重复定义defineModel 失败

</script>

<template>
  <br>
  <div>
    <!-- 组件内绑定 -->
    <input v-model="username"/>

    <p>输入值为:{{ username }}</p>
  </div>
  <br>
  <div>
    <input placeholder="输入密码" v-model="passwd"/>
    <!-- <input placeholder="输入文字" v-model="childString"/> -->
  </div>
</template>

<style>
</style>
